package com.iflytek.controller;

import java.util.List;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.iflytek.bean.StockInOrder;
import com.iflytek.service.SioApproveService;
import com.iflytek.vo.StockInOrderVO;
import com.iflytek.vo.layuiPage;
@RestController
@RequestMapping("/approve")
public class SioAprroveController {
	@Autowired
	private SioApproveService approveService;
	
	//展示
	@RequiresPermissions("approve:show")
	@GetMapping("/show")
	public Object goodsShow() {

		List<StockInOrderVO> Page =  approveService.selectByExample();
		
		layuiPage result = new layuiPage();
		result.setCode(0);
		result.setMsg("");
		result.setData(Page);
		return result;
	}
	
	@PostMapping("/updateApproveStatus")
	public Object updateApproveStatus(Integer id) {
		approveService.updateApproveStatus(id);
		StockInOrderVO order = approveService.selectOrderById(id);
		approveService.updateGoodsNum(order);
		layuiPage result = new layuiPage();
		result.setCode(0);
		result.setMsg("");
		return result;
	}
	
}
